<?php

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/

/*Route::get('/', function () {
    return view('welcome');
});*/

//用户模块
//注册界面
Route::get('/register', '\App\Http\Controllers\RegisterController@index');
//注册行为
Route::post('/register', '\App\Http\Controllers\RegisterController@register');
//登录页面
Route::get('/login', '\App\Http\Controllers\LoginController@index');
//登录行为
Route::post('/login', '\App\Http\Controllers\LoginController@login');
//登出行为
Route::get('/logout', '\App\Http\Controllers\LoginController@logout');
//个人设置页面
Route::get('/user/me/setting', '\App\Http\Controllers\UserController@setting');
//个人设置操作
Route::post('/user/me/setting', '\App\Http\Controllers\UserController@settingStore');

//主页，即文章列表页
Route::get('/posts', '\App\Http\Controllers\PostController@index');
//创建文章
Route::get('/posts/create', '\App\Http\Controllers\PostController@create');
Route::post('/posts', '\App\Http\Controllers\PostController@store');
//搜索结果页
Route::get('/posts/search', '\App\Http\Controllers\PostController@search');
//文章详情页
Route::get('/posts/{post}', '\App\Http\Controllers\PostController@show');
//编辑文章
Route::get('/posts/{post}/edit', '\App\Http\Controllers\PostController@edit');
//更新文章
Route::put('/posts/{post}', '\App\Http\Controllers\PostController@update');
//删除文章
Route::get('/posts/{post}/delete', '\App\Http\Controllers\PostController@delete');
//图片上传
Route::post('/posts/image/upload', '\App\Http\Controllers\PostController@imageUpload');
//提交评论
Route::post('/posts/{post}/comment', '\App\Http\Controllers\PostController@comment');
//赞
Route::get('/posts/{post}/zan', '\App\Http\Controllers\PostController@zan');
//取消赞
Route::get('/posts/{post}/unzan', '\App\Http\Controllers\PostController@unzan');

//个人中心
Route::get('/user/{user}', '\App\Http\Controllers\UserController@show');
//赞
Route::post('/user/{user}/fan', '\App\Http\Controllers\UserController@fan');
//取消赞
Route::post('/user/{user}/unfan', '\App\Http\Controllers\UserController@unfan');




/*
//路由支持get请求
Route::get('/', '[控制器]@[行为]');
//路由支持post请求
Route::post('/posts', '\App\Controllers\PostController@index');
//路由同时支持post和get请求
Route::match(['get', 'post'], '/posts', '\App\Controllers\PostController@index');
//路由支持所有的请求
Route::any('/', function () {
    return view('welcome');
});
//路由支持put请求
Route::put('/posts', '\App\Controllers\PostController@index');
//由于表单提交的过程中method方法只支持get和post请求，所以在提交时需要做一些处理
//
//  <form action="/posts" method="post">
//
//    <input type="hidden" name="_method" value="put"/>
//     或者直接使用laravel的方法:
//     {{ method_field("PUT") }}
//
//  </form>
//
*/

